const getUA = () => {
  return navigator?.userAgent.toLocaleLowerCase() ?? ''
}

export const isIpad: () => boolean = () => {
  const platform = navigator.platform === 'MacIntel' || navigator.platform === 'iPad'
  return (platform && navigator.maxTouchPoints > 1) || navigator.userAgent.match(/iPad/i) != null
}

export const isPC = (ua = getUA()) => {
  return !ua.match(/android|iphone|ipad|pod/i) && !isIpad()
}

export const isMobile = (ua = getUA()) => {
  return /iphone|ipad|ipod|ios|android|mobile/i.test(ua) || isIpad()
}
